﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
using Microsoft.Practices.Repository;
using DotNetCore.BannerManagement.Domain;

namespace DotNetCore.BannerManagement.DAL.Domain.dnc_AdvertiserRepositoryArtifacts
{
    /// <summary>
    /// Construct a dnc_Advertiser object from a datareader.
    /// </summary>
    internal class Getdnc_AdvertiserByUserIDFactory : IDomainObjectFactory<dnc_Advertiser>
    {
        public dnc_Advertiser Construct(IDataReader reader)
        {
            dnc_Advertiser dnc_Advertiser = new dnc_Advertiser();

            int iDIndex = reader.GetOrdinal("ID");
            if (!reader.IsDBNull(iDIndex))
            {
                dnc_Advertiser.ID = reader.GetInt32(iDIndex);

            }

            int nameIndex = reader.GetOrdinal("Name");
            if (!reader.IsDBNull(nameIndex))
            {
                dnc_Advertiser.Name = reader.GetString(nameIndex);

            }

            int userIdIndex = reader.GetOrdinal("UserId");
            if (!reader.IsDBNull(userIdIndex))
            {
                dnc_Advertiser.UserId = reader.GetString(userIdIndex);

            }


            return dnc_Advertiser;
        }
    }
}

